package com.zdd.ehe.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zdd.ehe.entity.Comment;
import com.zdd.ehe.entity.Role;
import com.zdd.ehe.mapper.CommentMapper;
import com.zdd.ehe.service.ICommentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ZhuiZhu
 * @since 2023-03-18
 */
@Service
public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> implements ICommentService {
    @Resource
    private CommentMapper commentMapper;

    /**
     * 添加评论数据
     *
     * @param comment
     * @return
     */
    @Override
    public int insrt(Comment comment) {
        int result = -1;
        try {
            result = commentMapper.insert(comment);
        }catch (Exception e){
            e.printStackTrace();

        }
        return result;
    }

    /**
     * 分页查询评论列表
     *
     * @param page
     * @return
     */
    @Override
    public Page<Comment> getAllCommentByPage(Page<Comment> page) {
        Page<Comment> pagex = commentMapper.getAllCommentByPage(page);
        return pagex;
    }


}
